﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace WebRequestHelper
{
    internal sealed class WebRequestState
    {

        public HttpWebRequest Request { get; set; }

        public HttpWebResponse Response { get; set; }

        public String RequestUri { get; set; }

        public WebRequestMethod Method { get; set; }

        public Dictionary<String, String> PostData { get; private set; }

        public GetResponseCompletedEventHandler Callback { get; private set; }

        public object UserState { get; private set; }


        public WebRequestState(WebRequestMethod method, String url, Dictionary<String, String> postData)
        {
            this.Method = method;
            this.RequestUri = url;
            this.PostData = postData;

            //if (postData != null && postData.Count > 0)
            //{
            //    foreach (var item in postData)
            //    {
            //        this.PostData.Add(item.Key, item.Value);
            //    }
            //}
        }

        public WebRequestState(WebRequestMethod method, String url, Dictionary<String, String> postData, object userState)
        {
            this.Method = method;
            this.RequestUri = url;
            this.PostData = postData;
            this.UserState = userState;
        }

        public WebRequestState(WebRequestMethod method, String url, Dictionary<String, String> postData, GetResponseCompletedEventHandler callback)
        {
            this.Method = method;
            this.RequestUri = url;
            this.PostData = postData;
            this.Callback = callback;
        }

        public WebRequestState(WebRequestMethod method, String url, Dictionary<String, String> postData, GetResponseCompletedEventHandler callback, object userState)
        {
            this.Method = method;
            this.RequestUri = url;
            this.PostData = postData;
            this.Callback = callback;
            this.UserState = userState;
        }
    }
}
